﻿namespace MockingBird.Studio.UI.UserControls
{
    using System.Windows.Forms;

    public partial class WsdlTree : UserControl
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        private ToolStripMenuItem mnuGenerateSample;
        private WsdlContextMenu wsdlContextMenu;


        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.tvwWsdl = new System.Windows.Forms.TreeView();
            this.mnuGenerateSample = new System.Windows.Forms.ToolStripMenuItem();
            this.wsdlContextMenu = new WsdlContextMenu();
            this.SuspendLayout();
            // 
            // tvwWsdl
            // 
            this.tvwWsdl.ContextMenuStrip = this.wsdlContextMenu;
            this.tvwWsdl.Font = new System.Drawing.Font("MS Reference Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tvwWsdl.Location = new System.Drawing.Point(8, 3);
            this.tvwWsdl.Name = "tvwWsdl";
            this.tvwWsdl.Size = new System.Drawing.Size(381, 492);
            this.tvwWsdl.TabIndex = 0;
            this.tvwWsdl.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvwWsdl_NodeMouseClick);
            // 
            // wsdlContextMenu
            // 
            this.wsdlContextMenu.Font = new System.Drawing.Font("Segoe UI", 9F);
            this.wsdlContextMenu.Name = "wsdlContextMenu";
            this.wsdlContextMenu.Size = new System.Drawing.Size(153, 26);
            this.wsdlContextMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.wsdlContextMenu_ItemClicked);
            // 
            // mnuGenerateSample
            // 
            this.mnuGenerateSample.Name = "mnuGenerateSample";
            this.mnuGenerateSample.Size = new System.Drawing.Size(32, 19);
            // 
            // WsdlTree
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.AutoSize = true;
            this.BackColor = System.Drawing.Color.Transparent;
            this.Controls.Add(this.tvwWsdl);
            this.Name = "WsdlTree";
            this.Size = new System.Drawing.Size(396, 506);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.TreeView tvwWsdl;


        #region "event handlers"

        private void tvwWsdl_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            this.tvwWsdl_MouseUp(sender, e);

        }

        private void tvwWsdl_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                //Select the clicked node
                tvwWsdl.SelectedNode = tvwWsdl.GetNodeAt(e.X, e.Y);
                if (tvwWsdl.SelectedNode != null)
                {
                    HandleWsdlNodeSelection(tvwWsdl.SelectedNode, tvwWsdl.SelectedNode.Level, e.Location);
                }
            }
        }

        private void wsdlContextMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            HandleContextMenuClick(e);
        }



        #endregion



    }
}
